package com.hishop.ware.service.impl;

import com.hishop.common.utils.PageUtils;
import com.hishop.common.utils.Query;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.hishop.ware.dao.WmsWareInfoDao;
import com.hishop.ware.entity.WmsWareInfoEntity;
import com.hishop.ware.service.WmsWareInfoService;


@Service("wmsWareInfoService")
public class WmsWareInfoServiceImpl extends ServiceImpl<WmsWareInfoDao, WmsWareInfoEntity> implements WmsWareInfoService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String key = (String) params.get("key");
        QueryWrapper<WmsWareInfoEntity> wareInfoEntityQuerWrapper = new QueryWrapper<WmsWareInfoEntity>();

        if (!StringUtils.isEmpty(key)) {
            wareInfoEntityQuerWrapper.eq("id",key)
                    .or().like("name",key)
                    .or().like("address",key)
                    .or().like("areacode",key);
        }

        IPage<WmsWareInfoEntity> page = this.page(
                new Query<WmsWareInfoEntity>().getPage(params),
                wareInfoEntityQuerWrapper
        );

        return new PageUtils(page);
    }

}